<?php
/**
 * Magento
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Academic Free License (AFL 3.0)
 * that is bundled with this package in the file LICENSE_AFL.txt.
 * It is also available through the world-wide-web at this URL:
 * http://opensource.org/licenses/afl-3.0.php
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@magento.com so we can send you a copy immediately.
 *
 * DISCLAIMER
 *
 * Do not edit or add to this file if you wish to upgrade Magento to newer
 * versions in the future. If you wish to customize Magento for your
 * needs please refer to http://www.magento.com for more information.
 *
 * @category    design
 * @package     base_default
 * @copyright   Copyright (c) 2006-2014 X.commerce, Inc. (http://www.magento.com)
 * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
 */
?>

<?php echo $this->getMessagesBlock()->toHtml() ?>
<form action="<?php echo $this->getUrl('customer/account/editPost') ?>" method="post" id="form-validate" autocomplete="off">
    <div class="fieldset">
        <?php echo $this->getBlockHtml('formkey')?>
        <h2 class="legend"><?php echo $this->__('Account Information') ?></h2>
        <ul class="form-list">
            <li class="fields">
                <?php //echo $this->getLayout()->createBlock('customer/widget_name')->setObject($this->getCustomer())->toHtml() ?>
                <div class="customer-name-middlename">
                    <div class="field name-firstname">
                        <label>用户名：</label>
                        <div class="input-box input-re input-bor">
                            <input type="text" id="firstname" value="<?php echo $this->escapeHtml($this->getCustomer()->getFirstname()) ?>" name="firstname" title="用户名" maxlength="255" class="input-text required-entry">
                        </div>
                    </div>
                    <div class="field name-lastname">
                        <label>店铺名：</label>
                        <div class="input-box input-re input-bor">
                            <input type="text" id="lastname" name="lastname" value="<?php echo $this->escapeHtml($this->getCustomer()->getLastname()) ?>" title="店铺名" maxlength="255" class="input-text required-entry">
                        </div>
                    </div>
                </div>
            </li>
            <li>
                <label>手机号码：</label>
                <div class="input-box input-re input-ress">
                    <input placeholder="<?php echo $this->__('手机号码') ?>" type="number" name="mobile" id="mobile" value="<?php echo $this->escapeHtml($this->getCustomer()->getMobile()) ?>" title="<?php echo $this->__('手机号码') ?>" class="input-text required-entry validate-mobile" />
                </div>
            </li>
            <li style="display:none">
                <div class="input-box input-re input-ress">
                    <input placeholder="<?php echo $this->__('Email Address') ?>" type="text" name="email" id="email" value="<?php echo $this->escapeHtml($this->getCustomer()->getEmail()) ?>" title="<?php echo $this->__('Email Address') ?>" class="input-text required-entry validate-email" />
                </div>
            </li>

            <li class="control">
                <input type="checkbox" name="change_password" id="change_password" value="1" onclick="setPasswordForm(this.checked)" title="<?php echo $this->__('修改密码') ?>"<?php if($this->getCustomer()->getChangePassword()==1): ?> checked="checked"<?php endif; ?> class="checkbox" /><label for="change_password"><?php echo $this->__('修改密码') ?></label>
            </li>
        </ul>
    </div>
    <div class="fieldset" style="display:none;">
        <h2 class="legend"><?php echo $this->__('修改密码') ?></h2>
        <ul class="form-list">
            <li>
                <label for="current_password" class="required"><?php echo $this->__('当前密码') ?></label>
                <div class="input-box">
                    <!-- This is a dummy hidden field to trick firefox from auto filling the password -->

                    <input type="password" title="<?php echo $this->__('当前密码') ?>" class="input-text" name="current_password" id="current_password" />
                </div>
            </li>
            <li class="fields">
                <div class="field">
                    <label for="password" class="required"><?php echo $this->__('新密码') ?></label>
                    <div class="input-box">
                        <input type="password" title="<?php echo $this->__('新密码') ?>" class="input-text validate-password" name="password" id="password" />
                    </div>
                </div>
                <div class="field">
                    <label for="confirmation" class="required"><?php echo $this->__('重新输入新密码') ?></label>
                    <div class="input-box">
                        <input type="password" title="<?php echo $this->__('重新输入新密码') ?>" class="input-text validate-cpassword" name="confirmation" id="confirmation" />
                    </div>
                </div>
            </li>
        </ul>
    </div>
    <div class="buttons-set">

        <p class="back-link"><a href="<?php echo $this->escapeUrl($this->getBackUrl()) ?>"><small>&laquo; </small><?php echo $this->__('Back') ?></a></p>
        <button type="submit" title="<?php echo $this->__('Save') ?>" class="button"><span><span><?php echo $this->__('Save') ?></span></span></button>
    </div>
</form>
<script type="text/javascript">
//<![CDATA[
    var dataForm = new VarienForm('form-validate', true);
    function setPasswordForm(arg){
        if(arg){
            $('current_password').up(3).show();
            $('current_password').addClassName('required-entry');
            $('password').addClassName('required-entry');
            $('confirmation').addClassName('required-entry');

        }else{
            $('current_password').up(3).hide();
            $('current_password').removeClassName('required-entry');
            $('password').removeClassName('required-entry');
            $('confirmation').removeClassName('required-entry');
        }
    }

    <?php if($this->getCustomer()->getChangePassword()): ?>
        setPasswordForm(true);
    <?php endif; ?>
//]]>
</script>
